package com.msmall.community.money.model;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.msmall.base.model.BaseObject;
import com.msmall.community.user.model.UserInfo;

@Entity
@Table(name="base_user_money")
public class Money extends BaseObject{

	private static final long serialVersionUID = 6058880013514375896L;

	@Id
	@Column(name="money_id",insertable=false,updatable=false)
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Long moneyId;
	
	@Column(name="money")
	private Float money; // 用户可用金币
	
	/**
	 *  0：正常，未锁定; 
	 *  1：锁定后积分不能进也不能出；
	 *  2：锁定后积分只能进不能出；
	 *  3：锁定后积分不能进但可以出
	 */
	@Column(name="lock_status")
	private Short lockStatus;
	
	@Column(name="start_time")
	@Temporal(TemporalType.TIMESTAMP)
	private Date startTime; //锁定的开始时间
	
	@Column(name="end_time")
	@Temporal(TemporalType.TIMESTAMP)
	private Date endTime; // 锁定结束时间
	
	@Column(name="lock_sake")
	private String lockSake;
	
	/**
	 * ConstantDB.VISIBLE
	 */
	@Column(name="visible")
	private Integer visible;

	/**
	 * 积分使用安全码
	 */
	@Column(name="safe_code")
	private String safeCode;
	
	@OneToOne(optional = false, cascade = CascadeType.REFRESH)  
    @JoinColumn(name = "user_id", referencedColumnName = "user_id",unique = true)
	private UserInfo user;
	
	public Long getMoneyId() {
		return moneyId;
	}

	public void setMoneyId(Long moneyId) {
		this.moneyId = moneyId;
	}

	public Float getMoney() {
		return money;
	}

	public void setMoney(Float money) {
		this.money = money;
	}

	public Short getLockStatus() {
		return lockStatus;
	}

	public void setLockStatus(Short lockStatus) {
		this.lockStatus = lockStatus;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public String getLockSake() {
		return lockSake;
	}

	public void setLockSake(String lockSake) {
		this.lockSake = lockSake;
	}

	public String getSafeCode() {
		return safeCode;
	}

	public void setSafeCode(String safeCode) {
		this.safeCode = safeCode;
	}

	public Integer getVisible() {
		return visible;
	}

	public void setVisible(Integer visible) {
		this.visible = visible;
	}

	public UserInfo getUser() {
		return user;
	}

	public void setUser(UserInfo user) {
		this.user = user;
	}

	@Override
	public boolean equals(Object o) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public int hashCode() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return null;
	}

}
